#include<bits/stdc++.h>
using namespace std;
using ll = long long;
ll mn1[10001];
ll mn2[10001];
ll n;
ll a[200001], b[200001];
void build(ll i, ll l, ll r) {
	if (l == r) {
		mn1[i] = a[l], mn2[i] = b[l];
		return;
	}
	ll mid = (l + r) / 2;
	build(i << 1, l, mid);
	build(i << 1 | 1, mid + 1, r);
	mn1[i] = min(mn1[i << 1], mn1[i << 1 | 1]);
	mn2[i] = min(mn2[i << 1], mn2[i << 1 | 1]);
}
ll mna(ll i, ll l, ll r, ll x, ll y) {
	if (x <= l && r <= y)
		return mn1[i];
	ll res = 1000000000;
	ll mid = (l + r) / 2;
	if (y >= mid + 1)
		res = min(res, mna(i << 1 | 1, mid + 1, r, x, y));
	if (x <= mid)
		res = min(res, mna(i << 1, l, mid, x, y));
	return res;
}
ll mnb(ll i, ll l, ll r, ll x, ll y) {
	if (x <= l && r <= y)
		return mn2[i];
	ll res = 1000000000;
	ll mid = (l + r) / 2;
	if (y >= mid + 1)
		res = min(res, mnb(i << 1 | 1, mid + 1, r, x, y));
	if (x <= mid)
		res = min(res, mnb(i << 1, l, mid, x, y));
	return res;
}
ll ansa(ll x) {
	return (x < 0 ? -x : x);
}
int main() {
	freopen("min3.in", "r", stdin);
	freopen(".out", "w", stdout);
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	cin >> n;
	for (int i = 1; i <= n; i++)
		cin >> a[i];
	for (int i = 1; i <= n; i++)
		cin >> b[i];
	if (n <= 1000) {
		build(1, 1, n);
		for (int i = 1; i <= n; i++) {
			ll ans = 1000000000;
			for (int k = 1; k + i - 1 <= n; k++)
				ans = min(ans, ansa(mna(1, 1, n, k, k + i - 1) - mnb(1, 1, n, k, k + i - 1)));
			cout << ans << '\n';
		}
	} else {
		if (b[1] == 1) {
			ll mx = 1000000000;
			for (int i = 1; i <= n; i++)
				mx = min(mx, a[i]);
			for (int i = 1; i <= n; i++)
				cout << ansa(mx - 1);
		} else {

		}
	}
	return 0;
}
